<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .image {
            margin: auto;
            width: 400px;
            height: 400px;
            border: 1px red solid;
            position: relative;
        }
        h1{
            text-align: center;
        }
        .d1img {

            width: 400px;
            height: 400px;

        }
        .image .two{
            position: absolute;
            left: 0;
            top: 0;
            height: 0;
            transition: height 0.8s ease;
        }
        .image:hover .two{
           height: 400px;
        }

        .image2 {
            margin: auto;
            width: 400px;
            height: 400px;
            border: 1px red solid;
            position: relative;
        }
        .four{
            position: absolute;
            left: 0;
            top: 0;
            opacity: 0;
            transition: opacity 1s ease;
        }
        .image2:hover .four{
            opacity: 1;
        }
    </style>
</head>

<body>
    
    <h1>鼠标悬停效果1</h1>
    <div class="image2">
        <img src="./image/铁路.jpg" alt=""class="d1img three">
        <img src="./image/道路.jpeg" alt=""class="d1img four">
    </div>
    <h1>鼠标悬停效果2</h1>
    <div class="image">
        <img src="./image/黑白.jpeg" alt="" class="d1img one">
        <img src="./image/黑白.png" alt="" class="d1img two">
    </div>
</body>

</html>